package client

import (
	"goruntimeDistributionCrawler/engine"
	"goruntimeDistributionCrawler/rpcsuport"
	"log"
)

func ItemSaver(
	host string)  (chan engine.Item,error){
	client,err:=rpcsuport.NewClient(host)

	if err !=nil{
       return nil,err
	}

	out:=make(chan engine.Item)
	go func() {
		item:=<-out
		result:=""
		err:=client.Call("ItemSaveService.Save",item,&result)

		if err !=nil || result!="ok"{
			log.Printf("save Error:%s,resul:%s",err,result)
		}
	}()
	return out,nil
}
